home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d883.lha / BBBBS / BBBBS59.lha / rexx / BBBBSdemon.baud < prev    next >
Text File  |  1992-05-01  |  3KB  |  91 lines

  1. /* $VER: 5.1 BBBBSdemon.baud 1 May 1992 (1.5.92)
  2.  
  3. USAGE: run rx BBBBSdemon.baud  ; run after BaudBandit is running
  4.  
  5. This program handles those cases where BBBBS might fail to properly
  6. log-off after a disconnect during transfer or message entry.
  7. (The classic case is a hangup during message entry, followed by
  8. numerous "RING"s... The BBS sees the RING and thinks the user is
  9. still entering text, so it doesn't close the buffer!)
  10.  
  11. Reboots after about 10 minutes (4 decreasing checks) if the user
  12. didn't logout (BBS_level~=''), and there is no carrier.
  13.  
  14. Does nothing the 1st time, then tries closing the buffer,
  15. and finally, on the third check, tries CTRL-C & ESC (nasty reset!).
  16. If all this fails to reset the BBS, the program boot is
  17. run if is found in the C: directory.
  18.  
  19. */
  20.  
  21.  
  22. IF SHOW('P','BBBBS_DEMON') THEN EXIT
  23. CALL OPENPORT('BBBBS_DEMON')
  24. CR='0D'x
  25. chances=1
  26. DO WHILE chances<5              /* 4 checks */
  27.   CALL DELAY(50*300%chances)    /* pauses get shorter with trouble */
  28.   p=GETPKT('BBBBS_DEMON')       /* ANY message means time to quit */
  29.   IF p~='0000 0000'x THEN
  30.     DO WHILE p~='0000 0000'x    /* empty the port */
  31.       DO
  32.         t=REPLY(p,0)
  33.         p=GETPKT('BBBBS_DEMON')
  34.       END
  35.       chances=5                 /* ... and quit */
  36.     END
  37.   ELSE IF GETCLIP('BBS_level')='' | ~SHOW('P','BAUD') THEN
  38.     chances=1   /* inactive bbs */
  39.   ELSE
  40.     DO
  41.       ADDRESS BAUD
  42.       dcd
  43.       IF RC=0 THEN
  44.         DO
  45.           chances=chances+1                   /* no carrier, so... */
  46.           IF chances=3 THEN
  47.             DO
  48.               Send '\r/END\r'   /* be sure buffer is closed */
  49.               IF GETCLIP('BBS_level')~='' THEN
  50.                 DO
  51.                   CALL DELAY(100)
  52.                   Send '\ah'
  53.                 END
  54.             END
  55.           IF chances=4 THEN Send '\aB\e'      /* ESCape to stop transfer */
  56.           IF chances=5 THEN                   /* time to die */
  57.             DO
  58.               SAY 'BBBBS_Demon calling reboot in 20 seconds...'
  59.               Send '\rBBBBS_Demon calling reboot in 20 seconds...\r'
  60.               chances=1
  61.               bbspath=GETCLIP('BBS_path')
  62.               IF bbspath~='' THEN
  63.                 ADDRESS COMMAND 'date >'bbspath'Numbers/LastDemonBoot'
  64.               DO i=1 TO 3
  65.                 CALL sound_badlogoff(i)
  66.               END
  67.               IF EXISTS('c:boot') THEN
  68.                 DO
  69.                   CALL DELAY(250)
  70.                   ADDRESS COMMAND boot
  71.                 END
  72.             END
  73.         END
  74.       ELSE chances=1
  75.       ADDRESS
  76.     END
  77. END
  78. CALL CLOSEPORT('BBBBS_DEMON')
  79. EXIT
  80.  
  81. sound_badlogoff:
  82. ARG mult .
  83. ADDRESS BAUD
  84. DO bp=1 TO 24
  85.   Beep (3200-bp*30*mult)
  86. END
  87. RETURN
  88.  
  89.  
  90. /* BBBBSdemon.baud */
  91.